Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(derive)!: Set both about/long_about with doc comments #3175

Merged
merged 3 commits into from
Dec 14, 2021

Conversation

epage
Copy link
Member

@epage epage commented Dec 14, 2021

The main care about is that when we override a flatten / subcommand doc comment in a parent
container, that we make sure we take nothing from the child container,
rather than implicitly taking one about ut not long_about.

To do this, and to play the most safe with long help detection, we reset
long_about to default when there is no doc comment body to use for
long_about.

Fixes #2983

BREAKING CHANGE: We changed the signatures for App::about,
App::long_about, Arg::help, and Arg::long_help from accepting anything Into<&str> to &str.

@pksunkara
Copy link
Member

So, my main concern with the proposal (and this PR) is that this would be redundant if we fix #2894. Especially since this contains an API change which doesn't mean anything else after that fix.

I had always the view that #2894 is the root issue we need to concentrate but I never had the time.

@pksunkara
Copy link
Member

Also, did you mean to link the correct issue to this PR?

I dislike the inconsistency with only a few fields providing this (this
and `help_heading`) but this is to address a specific bug.  We need to
visit this, along with iterators (clap-rs#2870) and string handling (clap-rs#2150).

`Arg` came along for the ride because the derive logic is applied to
both.  `PossibleValue` didn't need it because we filter out `long_help`.

BREAKING CHANGE: We changed the signatures for `App::about`,
`App::long_about`, `Arg::help`, and `Arg::long_help` from accepting
anything `Into<&str>` to `&str`.
The main care about is that when we override a `flatten` / `subcommand`
doc comment in a parent container, that we make sure we take nothing
from the child container, rather than implicitly taking one `about` ut
not `long_about`.

To do this, and to play the most safe with long help detection, we reset
`long_about` to default when there is no doc comment body to use for
`long_about`.

Fixes clap-rs#2983
@epage epage merged commit b3315f9 into clap-rs:master Dec 14, 2021
@epage epage deleted the help branch December 14, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--help message randomly show and hide docs lines
2 participants